package com.wd.amodel;

import android.app.Application;

import com.wd.base.component.AppConfig;
import com.wd.base.component.ComponentsService;
import com.wd.base.component.IAppComponent;
import com.wd.base.config.Constance;
import com.wd.base.router.ARouter;
import com.wd.base.service.ServiceFactory;
import com.wd.base.service.listener.IServiceRegister;
import com.wd.base.service.listener.InitListener;
import com.wd.base.util.Logger;
import com.wd.common.userservice.IMemberCommonService;
import com.wd.common.userservice.IUserCommonService;

/**
 * NA<BR>
 *
 * @author w4425
 * @version [V2.0.0, 2021/4/21]
 * @since V2.0.0
 */
public class DemoApp extends Application implements IAppComponent {
    @Override
    public void initialize(Application app) {
        Logger.d("initialize start");
        // 注册自己到组件服务
        ComponentsService.setAppComponent(AppConfig.PAGE_TYPE.DEMO_A, this);
        if (!Constance.isRouterAnnotation) {
            ARouter.getInstance().addActivity(Constance.MODULE_URL_DEMO_A, DemoActivity.class);
        }
        //注册服务组件
        ServiceFactory.init(new InitListener() {
            @Override
            public void registerService(IServiceRegister register) {
                register.registerComponent(IUserCommonService.class, "com.wd.user.UserCommonServiceImpl");
                register.registerComponent(IMemberCommonService.class, "com.wd.user.MemberCommonServiceImpl");
            }
        });
    }
}
